home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / src / bin / sweep / sweep.main.c < prev   
C/C++ Source or Header  |  1993-03-05  |  2KB  |  91 lines

  1. #include <stdio.h>
  2. #include <math.h>
  3. #include "forms.h"
  4. #include "geom.h"
  5. #include "point3.h"
  6. #include "formsx.h"
  7. #include "panel.h"
  8. #include "sweep.h"
  9.  
  10. main() {
  11.  
  12.   foreground();
  13.  
  14.   create_the_forms();
  15.   fl_set_button(TransSweep, 1);
  16.   fl_set_button(RadButton, 1);
  17.  
  18.   flx_set_input_printf(Transxdir, "%.2f", 0.0);
  19.   flx_set_input_printf(Transydir, "%.2f", 0.0);
  20.   flx_set_input_printf(Transzdir, "%.2f", 1.0);
  21.   flx_set_input_printf(Translength, "%.2f", 1.0);
  22.   
  23.   flx_set_input_printf(Rotlength, "%.2f", 2.0 * M_PI);
  24.   flx_set_input_int(Rotdivisions, 10);
  25.   flx_set_input_float(Rotendx, 0.0);
  26.   flx_set_input_float(Rotendy, 0.0);
  27.   flx_set_input_float(Rotendz, 0.0);
  28.   flx_set_input_float(Rotdirx, 0.0);
  29.   flx_set_input_float(Rotdiry, 1.0);
  30.   flx_set_input_float(Rotdirz, 0.0);
  31.  
  32.   fl_hide_object(RotGroup);
  33.  
  34.   fl_show_form(MainForm, FL_PLACE_SIZE, TRUE, "Sweep");
  35.   while(1) fl_do_forms();
  36. }
  37.  
  38.  
  39. void RotSweepProc(FL_OBJECT *obj, long val) {
  40.   fl_hide_object(TransGroup);
  41.   fl_show_object(RotGroup);
  42. }
  43.  
  44.  
  45. void TransSweepProc(FL_OBJECT *obj, long val) {
  46.   fl_hide_object(RotGroup);
  47.   fl_show_object(TransGroup);
  48. }
  49.  
  50.  
  51. void GoButtonProc(FL_OBJECT *obj, long val) {
  52.   Geom *g, *s;
  53.   Point3 pt1, pt2;
  54.  
  55.   printf("(write geometry - targetgeom bare)");
  56.   fflush(stdout);
  57.   g = GeomFLoad(stdin, NULL);
  58.  
  59.   if (fl_get_button(RotSweep)) {
  60.     pt1.x = flx_get_input_float(Rotendx);
  61.     pt1.y = flx_get_input_float(Rotendy);
  62.     pt1.z = flx_get_input_float(Rotendz);
  63.     pt2.x = flx_get_input_float(Rotdirx);
  64.     pt2.y = flx_get_input_float(Rotdiry);
  65.     pt2.z = flx_get_input_float(Rotdirz);
  66.     s = RotationSweep(flx_get_input_float(Rotlength) * 
  67.               (fl_get_button(DegButton) ? M_PI / 180.0 : 1.0), 
  68.               &pt1, &pt2, 
  69.               flx_get_input_int(Rotdivisions), g);
  70.   } else {
  71.     pt1.x = flx_get_input_float(Transxdir);
  72.     pt1.y = flx_get_input_float(Transydir);
  73.     pt1.z = flx_get_input_float(Transzdir);
  74.     s = TranslationSweep(flx_get_input_float(Translength), &pt1, g);
  75.   }
  76.  
  77.   if (s != NULL) {
  78.     printf("(geometry sweep { ");
  79.     GeomFSave(s, stdout, NULL);
  80.     printf(" } ) ");
  81.     fflush(stdout);
  82.   }
  83.   GeomDelete(g);
  84.   GeomDelete(s);
  85.                
  86. }
  87.  
  88. void QuitButtonProc(FL_OBJECT *obj, long val) {
  89.   exit(0);
  90. }
  91.